<template>
  <div class="count">
    <h1 ref="countEle">
      {{ count }}
    </h1>
    <button @click="add">点我累加</button>
    <button @click="getEle">点我获取h1</button>
  </div>
</template>

<script>
export default {
  name: "Count",
  data(){
    return{
      count:0
    }
  },
  methods:{
    add(){
      this.count++
    },
    getEle(){
      // console.log(this);
      console.log(this.$refs.countEle);
    }
  }
};
</script>

<style scoped>
.count {
  background: yellow;
  height: 100px;
}
</style>